using System;

namespace wMobinium.core.test
{
    [NUnit.Framework.TestFixture]
    public class TestStartEventArgsTest
    {
        [NUnit.Framework.Test]
        public void EnsureSerializationWorks()
        {
            TestStartEventArgs testStartEventArgs =
                new TestStartEventArgs("OutlookContacts.Tests", "OutlookContactTest", "ensureContactIsEqual");
            testStartEventArgs.TimeStamp = DateTime.Parse("Jan/01/2007");
            string serialized = testStartEventArgs.Serialize();
            NUnit.Framework.Assert.AreEqual(expectedOutput(), serialized);
        }

        [NUnit.Framework.Test]
        public void EnsureDeserializationWorks()
        {
            TestStartEventArgs expectedTestStartEventArgs =
                new TestStartEventArgs("OutlookContacts.Tests", "OutlookContactTest", "ensureContactIsEqual");
            TestStartEventArgs actualTestStartEventArgs = TestStartEventArgs.Deserialize(expectedOutput());

            NUnit.Framework.Assert.AreEqual(expectedTestStartEventArgs, actualTestStartEventArgs);
        }

        public string expectedOutput()
        {
            return
                "<?xml version=\"1.0\" encoding=\"utf-16\"?>\r\n<teststarteventargs xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" assemblyname=\"OutlookContacts.Tests\" classname=\"OutlookContactTest\" methodname=\"ensureContactIsEqual\" timestamp=\"2007-01-01T00:00:00\" />";
        }
    }
}